<html>
    <head>
        <!-- import jQuery -->
        <script type="text/javascript" src="/js/jquery-1.7.2.min.js"></script>
        <script type="text/javascript">
            $(document).ready(function() {
                $('#textId').keypress(function(event) {
                    var keycode = (event.keyCode ? event.keyCode : event.which);
        	    if (keycode == 13 ) {
                        $('#textId').hide();                
                        $('#labelId').show();
                        //AJAX query here

                        $('#labelId').html($('#textId').val());                    
                    }            
                });
                $('#textId').hide();
            $(document).ready(function() {
                $('#labelId').dblclick(function() { 
                    $(this).hide();
                    $('#textId').show();
                    $('#textId').val($('#labelId').text());
                });
            });

            });            
        </script>        
    </head>
    <body>
        <div id="labelId" style="width:200px; text-align:center">
            Test label text!
        </div>
        <input id="textId" type="text" value="v" style="width:200px;"/>
    </body>
</html>

